package TestDemo;

import java.util.Random;

/**
 * @author げっしょく
 * @date 2021/7/13
 */
public class Test01 {
    public static void main(String[] args) {
        Random r = new Random();
        int[] arr = new int[5];
        for (int i = 0; i < arr.length; i++) {
            int b = r.nextInt(100) + 1;
            arr[i] = b;
        }
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }
        System.out.println("数组的总和为："+sum);
        for (int i = 0; i < arr.length; i++) {
            if(i == 0 || i % 2 ==0 && arr[i] % 2 ==0){
                System.out.println("数组中角标和对应元素都是偶数的有："+arr[i]);
            }
        }
    }
}
